<?php
// +----------------------------------------------------------------------
// | Fanwe 方维众筹商业系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 甘味人生(526130@qq.com)
// +----------------------------------------------------------------------
$payment_lang = array(
		'name'	=>	'富友资金托管',
		'mchnt_cd'	=>	'商户编号',
		'mchnt_name'	=>	'商户登录账户',
		'mchnt_user_id'	=>	'商户收款会员编号',
		'check_url'		=>	'验证地址',
		'is_debug'		=>	'测试帐户',
		'is_debug_0'		=>	'否',
		'is_debug_1'		=>	'是',	
);


$config = array(
		'mchnt_cd'	=>	array(
				'INPUT_TYPE'	=>	'0'
		),
		'mchnt_name'	=>	array(
				'INPUT_TYPE'	=>	'0'
		),
		'mchnt_user_id'	=>	array(
				'INPUT_TYPE'	=>	'0'
		),
		'check_url'	=>	array(
				'INPUT_TYPE'	=>	'0'
		),	
		'is_debug'	=>	array(
				'INPUT_TYPE'	=>	'1',
				'VALUES'	=>	array(0,1),
		),
);

/* 模块的基本信息 */
if (isset($read_modules) && $read_modules == TRUE)
{
	$module['class_name']    = 'Fuioupay';

	/* 名称 */
	$module['name']    = $payment_lang['name'];

	/* 配送 */
	$module['config'] = $config;

	$module['lang'] = $payment_lang;

	/* 插件作者的官方网站 */
	$module['reg_url'] = 'http://www.fanwe.com';

	return $module;
}

require_once(APP_ROOT_PATH.'system/collocation/fuioupay/fuiou_rsa.function.php');
require_once(APP_ROOT_PATH.'system/collocation/fuioupay/log_result.php');
class Fuioupay_collocation  {


	private $mchnt_cd ="";
	private $mchnt_name;
	private $mchnt_user;
	private $mchnt_txn_ssn= "";
	//正式环境
	private $collocation_cfg = "";
	
	function __construct(){
		//公钥地址
		if(!defined("PUBILC_KEY_PATH"));
			define('PUBILC_KEY_PATH', APP_ROOT_PATH."system/collocation/fuioupay/php_pbkey.pem");
		//私钥地址
		if(!defined("PRIVATE_KEY_PATH"));
			define('PRIVATE_KEY_PATH', APP_ROOT_PATH."system/collocation/fuioupay/php_prkey.pem");
		
		if(!defined("COLLNAME"));
			define("COLLNAME", getCollName());
		
		$collocation_item = $GLOBALS['db']->getRow("select config from ".DB_PREFIX."collocation where class_name='Fuioupay'");
		$collocation_cfg = unserialize($collocation_item['config']);
        $collocation_cfg['is_debug'] = 1 ;
		$this->collocation_cfg=$collocation_cfg;
		$this->mchnt_cd = $collocation_cfg['mchnt_cd'];
		$this->mchnt_name = $collocation_cfg['mchnt_name'];	
		if($collocation_cfg['mchnt_user_id']!="")
			$this->mchnt_user =$collocation_cfg['mchnt_user_id'];

		$check_url = $collocation_cfg['check_url'];

		if ($collocation_cfg['is_debug'] == 1){
			//$this->post_url="https://jzh-test.fuiou.com/jzh/";
            $this->post_url= "https://jzh.fuiou.com/";
		}else{
			$this->post_url= "https://jzh.fuiou.com/";
		}
		if(!defined("POST_URL"));
			define('POST_URL',$this->post_url);
 		$GLOBALS['cache']->set("Fuioupay_sign_url",$check_url);
 	} 
	
	function login_ips($user_id)
	{
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/login.php');
		
		return login($user_id,$this->MerCode,$this->post_url);
	}
	
	/**
	 * 创建新帐户
	 * @param int $user_id
	 * @param unknown_type $post_url
	 * @return string
	 */
	function CreateNewAcct($user_id){
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/CreateNewAcct.php');
		$sys = "pc";
		if($_REQUEST['from'] == "index" || $_REQUEST['from']=="")
		{
			$this->post_url=$this->post_url;
		}
		else
		{
			$this->post_url=$this->post_url.'app/appWebReg.action';
			$sys = "wap";
		}

		return CreateNewAcct($user_id,$this->mchnt_cd,$this->post_url,$sys);
	}
	
	/**
	 * 账户余额查询(WS) 
	 * @param int $user_id
	 * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id
	 * @param unknown_type $post_url
	 * @return
			响应码	resp_code 0000：成功  其他失败
			商户代码	mchnt_cd
			请求流水号	mchnt_txn_ssn
			签名数据	signature
			results :{
				用户名	User_id
				账面总余额	ct_balance
				可用余额	ca_balance
				冻结余额	cf_balance
				未转结余额	cu_balance
			}
	 */
	function QueryForAccBalance($user_id,$user_type){
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/QueryForAccBalance.php');
		$this->post_url=$this->post_url.'BalanceAction.action';
		return QueryForAccBalance($user_id,$this->mchnt_cd,$this->post_url);			
	}
	
	function query($user_id){	
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/query.php');
		$this->post_url=$this->post_url.'query.action';
		return query($user_id,$this->mchnt_cd,$this->post_url);		
	}
	
	
	/**
	 * 充值
	 * @param int $user_id
	 * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id
	 * @param float $pTrdAmt 充值金额
	 * @param unknown_type $post_url
	 * @param unknown_type $pTrdBnkCode  易宝参数（本接口未使用）
	 * 
	 * @return string
	 */
	function DoDpTrade($user_id,$user_type,$pTrdAmt,$pTrdBnkCode){
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoDpTrade.php');
		
		if($_REQUEST['from'] == "index" || $_REQUEST['from']=="")
		{
			if($pTrdBnkCode == 0)
			{
				$this->post_url=$this->post_url.'500405.action';
			}
			elseif($pTrdBnkCode == 1)
			{
				$this->post_url=$this->post_url.'500002.action';
			}
		}
		else
		{
			$this->post_url=$this->post_url.'app/500002.action';
		}
		
		return DoDpTrade($user_id,$this->mchnt_cd,$pTrdAmt,$this->post_url,$sys);		
	}
	
	/**
	 * 用户提现
	 * @param int $user_id
	 * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id
	 * @param float $pTrdAmt 提现金额
	 * @param unknown_type $post_url
	 * @return string
	 */
	function DoDwTrade($user_id,$user_type,$pTrdAmt,$post_url,$from){
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoDwTrade.php');


		if(strim($_REQUEST['from']) == "index" || $_REQUEST['from']=="")
		{
			$this->post_url=$this->post_url.'500003.action';
		}
		else
		{
			$this->post_url=$this->post_url.'app/500003.action';
		}

		return DoDwTrade($user_id,$this->mchnt_cd,$pTrdAmt,$this->post_url,$from);
	}
	
	function GetBankList(){
		//require_once(APP_ROOT_PATH.'system/collocation/ips/GetBankList.php');
		
		//return GetBankList($this->MerCode,$this->cert_md5,$this->ws_url);
		$result = array ();
		$result ['pErrCode'] = '0000';
		$result ['pErrMsg'] = '';
		
		$ankList = array();
		if(!isApp() && !isMobile())
		{
			$BankList[] = array('name'=>'富友托管','sub_name'=>'快捷充值','id'=>'0');
			$BankList[] = array('name'=>'富友托管','sub_name'=>'网银充值','id'=>'1');
		}
		else
		{
			$BankList[] = array('name'=>'富友托管','sub_name'=>'在线充值','id'=>'0');
		}
		$result ['BankList'] = $BankList;
		
		return $result;
	}
	
	/**
	 * 标的登记 及 流标
	 * @param int $deal_id
	 * @param int $pOperationType 标的操作类型，1：新增，2：结束,3:满标 “新增”代表新增标的，“结束”代表标的正常还清、丌 需要再还款戒者标的流标等情况。标的“结束”后，投资 人投标冻结金额、担保方保证金、借款人保证金均自劢解 冻
	 * @param int $status; 0:新增; 1:标的正常结束; 2:流标结束
	 * @param string $status_msg 主要是status_msg=2时记录的，流标原因
	 */
	function RegisterSubject($deal_id,$pOperationType,$status, $status_msg){
		
		if ($pOperationType == 1){
			$data = array();		
			$data['ips_bill_no'] = $deal_id;
			$data['mer_bill_no'] = $deal_id;
			$GLOBALS['db']->autoExecute(DB_PREFIX."deal",$data,'UPDATE',"id=".$deal_id);
			
			showIpsInfo('同步成功',SITE_DOMAIN.APP_ROOT."/m.php?m=Deal&a=index");
			
		}else if ($pOperationType == 2 && $status == 2){
			//满标放款
			require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoLoans.php');
			
			$this->post_url=$this->post_url.'preAuthCancel.action';
			
			$result = DoLoans($pOperationType,$deal_id,$status,$this->mchnt_cd,$this->post_url);
			//print_r($result);die;
			return showIpsInfo($result["info"],SITE_DOMAIN.APP_ROOT."/m.php?m=Deal&a=flow");
		}else if ($pOperationType == 2 && $status == 1){
			//本地解冻:借款保证金,担保保证金0
			$sql = "update ".DB_PREFIX."deal set ips_over = 1 ,un_real_freezen_amt = real_freezen_amt,un_guarantor_real_freezen_amt = guarantor_real_freezen_amt where id = ".$deal_id;
			$GLOBALS['db']->query($sql);	
			//http://p2p.fanwe.net/m.php?m=Deal&a=index&
			$url = SITE_DOMAIN.APP_ROOT.'/m.php?m=Deal&a=index';
			showIpsInfo('操作成功',$url); 
		}
	}	
	

	/**
	 * 投标
	 * @param int $order_id  标的ID
	 * @param float $pAuthAmt 投资金额
	 * @return string
	 */
	 //$user_id,$deal_id,$pAuthAmt,$ecv_id=0,$interestrate_id=0,$use_interestrate=0,$is_auto=0
	 //$autobid_user['id'], $deal_info['id'],$biddata['money'] ,0,0,0,0,$biddata['is_auto']
	function RegisterCreditor($user_id,$deal_id,$pAuthAmt,$ecv_id=0,$interestrate_id=0,$use_interestrate=0){
	//function RegisterCreditor($user_id,$deal_id,$pAuthAmt,$pBonuAmt,$return_code = 0){
		if(isset($_REQUEST['return_code'])){
			$return_code = intval($_REQUEST['return_code']);
		}
		
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RegisterCreditor.php');
		//$pay_radio_type = $GLOBALS['db']->getRow("select pay_radio_type from ".DB_PREFIX."deal where id=".$order_id);
		$pay_radio_type = 1;
		if($pay_radio_type){
			$this->post_url=$this->post_url.'preAuth.action';
		}else{
			$this->post_url=$this->post_url.'freeze.action';
		}
		
		//$result =  RegisterCreditor($user_id,$deal_id,$pAuthAmt,$this->mchnt_cd, $this->post_url,$is_auto);
		$result = RegisterCreditor($user_id,$deal_id,$pAuthAmt,$ecv_id,$interestrate_id,$use_interestrate,$this->mchnt_cd, $this->post_url);

		$res = RegisterCreditorCallBack($result);
		if($return_code==1){
			if($res['resp_code']=="0000" && $res['status']==1){
				$message = "投资成功";
				return json_encode(array("status"=>1,"info"=>$message));
			}
			else{
				$fuiou_code = fuiou_code();
				$message = $fuiou_code[$res['resp_code']];
				
				if((int)$res['status']==0){
					$message = $res['message'];
				}
				if(empty($message)) $message= "投资失败";
				return json_encode(array("status"=>0,"info"=>$message));
			}
		}
		else{
			if($res['resp_code']=="0000" && $res['status']==1){
				if($_REQUEST['from']=="wap"){
					showIpsInfo("投资成功",SITE_DOMAIN.wap_url('index',"deal",array("id"=>$deal_id)));
				}
				else{
					showIpsInfo("投资成功",SITE_DOMAIN.url('index',"deal#index",array("id"=>$deal_id)));
				}
			}
			else{
				$fuiou_code = fuiou_code();
				$message = $fuiou_code[$res['resp_code']];
				
				if((int)$res['status']==0){
					$message = $res['message'];
				}
				
				if($_REQUEST['from']=="wap"){
					showIpsInfo($message,SITE_DOMAIN.wap_url('index',"deal",array("id"=>$deal_id)));
				}
				else{
					showIpsInfo($message,SITE_DOMAIN.url('index',"deal#index",array("id"=>$deal_id)));
				}
			}
		}
	}
	/**
	 * 绑定银行卡
	 * @param unknown_type $user_id
	 */
	function BindBankCard($user_id){
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/BindBankCard.php');
		$this->post_url=$this->post_url.'changeCard2.action';
		return BindBankCard($user_id,$this->mchnt_cd,$this->post_url);
	}
	
	/**
	 * 还款
	 * @param deal $deal  标的数据
	 * @param array $repaylist  还款列表
	 * @param int $deal_repay_id  还款计划ID
	 * @param int $MerCode  商户ID
	 * @param string $cert_md5 
	 * @param string $post_url
	 * @return string
	 */
	function RepaymentNewTrade($deal, $repaylist, $deal_repay_id){

		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RepaymentNewTrade.php');
		$this->post_url=$this->post_url.'transferBu.action';
		
		return RepaymentNewTrade($deal,$repaylist,$deal_repay_id,$this->mchnt_cd,$this->post_url,$this->mchnt_user);
		
	}
	
	/**
	 * 提前还款
	 * @param deal $deal  标的数据
	 * @param array $repaylist  还款列表
	 * @param int $MerCode  商户ID
	 * @param string $cert_md5 
	 * @param string $post_url
	 * @return string
	 */
	function RepaymentNewTradeInrepay($deal, $repaylist,$k_repay_key){

		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RepaymentNewTradeInrepay.php');
		$this->post_url=$this->post_url.'transferBu.action';
		
		return RepaymentNewTradeInrepay($deal,$repaylist,$this->mchnt_cd,$this->post_url,$this->mchnt_user,$k_repay_key);
		
	}
	
	/**
	 * 登记债权转让
	 * @param int $transfer_id  转让id
	 * @param int $t_user_id  受让用户ID
	 * @param int $MerCode  商户ID
	 * @param string $cert_md5 
	 * @param string $post_url
	 * @return string
	 */
	function RegisterCretansfer($transfer_id,$t_user_id,$pBonuAmt){
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RegisterCretansfer.php');
		$this->post_url=$this->post_url.'transferBu.action';
		return RegisterCretansfer($transfer_id,$t_user_id, $this->mchnt_cd,$this->post_url,$this->mchnt_user);
	}
	
	/**
	 * 资金划拨
	 * @param int $in_user_id  划入用户id
	 * @param int $out_user_id  划出
	 * @param string $pBonuAmt 金额
	 * @return string
	 */
	function transferBu($in_user_id,$out_user_id,$pBonuAmt,$deal_id=0,$is_trans=0,$money_type,$memo){
		require_once APP_ROOT_PATH.'system/collocation/fuioupay/transferBu.php';
		$this->post_url=$this->post_url.'transferBu.action';
		if($in_user_id==0)
			$in_user_id = $this->mchnt_user;
		if($out_user_id==0)
			$out_user_id = $this->mchnt_user;
		
		
		return transferBu($in_user_id,$out_user_id,$pBonuAmt,$this->mchnt_cd,$this->post_url,$deal_id,$is_trans,$money_type,$memo);
	}

	/**
	 * 转帐
	 * @param int $pTransferType;//转账类型  否  转账类型  1：投资（报文提交关系，转出方：转入方=N：1），  2：代偿（报文提交关系，转出方：转入方=1：N），  3：代偿还款（报文提交关系，转出方：转入方=1：1），  4：债权转让（报文提交关系，转出方：转入方=1：1），  5：结算担保收益（报文提交关系，转出方：转入方=1： 1）
	 * @param int $deal_id  订单id
	 * @param string $ref_data 逗号分割的,代偿，代偿还款列表; 债权转让: id; 结算担保收益:金额，如果为0,则取fanwe_deal.guarantor_pro_fit_amt ;
	 * @return string
	 */
	function Transfer($pTransferType, $deal_id, $ref_data){
		$result =array();
		$result["status"] = 0;
		if ($pTransferType == 1 || $pTransferType == 2){
			//满标放款
			require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoLoans.php');
			
			if($pTransferType == 1){
				$this->post_url=$this->post_url.'transferBu.action';
			}elseif($pTransferType == 2){
				$this->post_url=$this->post_url.'preAuthCancel.action';
			}		
			
			$res = DoLoans($pTransferType,$deal_id,$ref_data,$this->mchnt_cd,$this->post_url,$this->mchnt_user);
			if($res['status']){
				if($pTransferType == 1){
					//$result["status"] = 1;
					//$result["info"] = "转账成功";
					//$results['url'] = url("DealEstateOnline#pay_log",array("id"=>$deal_id));
					showIpsInfo($res["info"],SITE_DOMAIN.APP_ROOT."/m.php?m=Deal&a=index");
				}
				if($pTransferType == 2){
					/*$result["status"] = 2;
					$result["info"] = "批量退款成功";
					$results['url'] = url("DealEstateOnline#index");*/
					showIpsInfo("批量退款成功",SITE_DOMAIN.APP_ROOT.'/m.php?m=Deal&a=index');
				}
			}else{
				$result["info"] = "转账/退款失败！";
				$results['url'] = url("DealEstateOnline#index");
				showIpsInfo("转账/退款失败！",SITE_DOMAIN.APP_ROOT.'/m.php?m=Deal&a=index');
			}
		
		}
		return $result;
	}
	/**
	 * 冻结到冻结 转账
	 * @param int $user_id;
	 * @param int $tuser_id 
	 * @param int $send_user_money
	 * @return string
	 */
	function TransferBuAndFreeze($user_id, $tuser_id, $send_user_money){
		$result =array();
		$result["status"] = 0;
		
		//满标放款
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/TransferBuAndFreeze.php');
		$this->post_url=$this->post_url.'transferBuAndFreeze2Freeze.action';
		$res =  TransferBuAndFreeze($user_id, $tuser_id, $send_user_money,$this->mchnt_cd,$this->post_url);
		if($res['status']){
			//执行解冻
			if($this->TransferUnfreeze($user_id,$res['suc_amt'])){
				$result["status"] = 1;
				$result["info"] = "转账成功";
			}else{
				$result["status"] = 1;
				$result["info"] = "转账成功,解冻失败";
			}
		}else{
			$result["info"] = "转账失败！";
		}
		return $result; 
	}

	/**
	 * 冻结到冻结 解冻
	 * @param $user_id 解冻目标账户
	 * @param $pTrdAmt 冻结金额
	 * @return string
	 */
	function TransferUnfreeze($user_id,$pTrdAmt){
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/TransferUnfreeze.php');
		$this->post_url=POST_URL.'unFreeze.action';
		return TransferUnfreeze($user_id,$this->mchnt_cd,$pTrdAmt,$this->post_url);
	}
	/**
	 * 撤标
	 * @param int $deal_deal_id
	 */
	function DoBidsOne($deal_load_id){
		
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoBidsOne.php');
		
		$this->post_url = $this->post_url."preAuthCancel.action";

		$res = DoBidsOne($deal_load_id,$this->mchnt_cd,$this->post_url);
		
		$return_code = isset($_REQUEST['return_code']) ? intval($_REQUEST['return_code']) : intval($_REQUEST['is_ajax']);
		
		if($return_code==1){
			if($res['resp_code']=="0000" && $res['status']==1){
				$message = "操作成功";
				return json_encode(array("status"=>1,"info"=>$message,"is_ajax"=>1));
			}
			else{
				$fuiou_code = fuiou_code();
				$message = $fuiou_code[$res['resp_code']];
				
				if((int)$res['status']==0){
					$message = $res['message'];
				}
				
				return json_encode(array("status"=>0,"info"=>$message));
			}
		}
		else{
			if($res['resp_code']=="0000" && $res['status']==1){
				showIpsInfo("操作成功",SITE_DOMAIN.APP_ROOT."/m.php?m=Loads&a=index&");
			}
			else{
				$fuiou_code = fuiou_code();
				$message = $fuiou_code[$res['resp_code']];
				
				//if((int)$res['status']==0){
					$message = $res['message'];
				//}
				
				showIpsInfo($message,SITE_DOMAIN.APP_ROOT."/m.php?m=Loads&a=index&");
			}
		}
	}
	/*冻结 到 转账
	 * 
	 * 
	 */
	 function FreezeToTransfer($user_id,$tuser_id,$pTrdAmt,$mchnt_name=0){
		$result =array();
		$result["status"] = 0;
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/FreezeToTransfer.php');
		$this->post_url=$this->post_url.'transferBmu.action';
		if($mchnt_name==1){
			$user_id = $this->mchnt_name;
		}else{
			$user_id =$user_id;
		}
		
		$res = FreezeToTransfer($user_id,$tuser_id,$pTrdAmt,$this->mchnt_cd,$this->post_url,'',$mchnt_name);
		if($res['status']){
			$result["status"] = 1;
			$result["info"] = "佣金发放成功";
		}else{
			
			$result["info"] = "佣金发放失败！";
		}
		return $result;
	}
	/**
	 * 资金冻结
	 * @param int $user_id
	 * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id
	 * @param float $pTrdAmt 充值金额
	 * @param unknown_type $MerCode
	 * @param unknown_type $cert_md5
	 * @param unknown_type $post_url
	 * @return string
	 */
	function SincerityGoldFreeze($user_id,$user_type,$pTrdAmt,$deal_id,$from,$pTrdBnkCode,$relate_id){	
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/SincerityGoldFreeze.php');
		$this->post_url=$this->post_url."freeze.action";
		return SincerityGoldFreeze($user_id,$this->mchnt_cd,$pTrdAmt,$deal_id,$from,$this->post_url,$relate_id);		
	}
	
		/**
	 * 解冻资金
	 * @param mchnt_cd 商户编号
	 * @param $freezeRequestNo 冻结时的请求流水号
	 * @return string
	 */
	function SincerityGoldUnfreeze($user_id,$user_type,$relate_id,$deal_id,$pTrdBnkCode){
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/SincerityGoldUnfreeze.php');
		$this->post_url=POST_URL.'unFreeze.action';
		return SincerityGoldUnfreeze($user_id,$this->mchnt_cd,$relate_id,$deal_id,$this->post_url,$this->sys);				
	}
	
	
	function DoSiteRepay($deal,$repaylist,$deal_repay_id)
	{
		require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoSiteRepay.php');
		$this->post_url=POST_URL.'transferBu.action';
		return DoSiteRepay($deal,$repaylist,$deal_repay_id,$this->mchnt_cd,$this->post_url,$this->mchnt_user);				
	}

	//(显式回调)
	function response($request,$class_act){
		$fuiou_code = fuiou_code();
		$fuioupay_log = array();
		$fuioupay_log['code'] = 'response';
		$fuioupay_log['create_date'] = to_date(TIME_UTC,'Y-m-d H:i:s');
		$fuioupay_log['html'] = http_build_query($_REQUEST);
		$GLOBALS['db']->autoExecute(DB_PREFIX."fuioupay_log",$fuioupay_log);

		$Sign_data = array();
		if($request){
			$sign = $request["signature"];
			$Sign_data['mchnt_cd'] = $request['mchnt_cd'];
			$Sign_data['mchnt_txn_ssn'] = $request['mchnt_txn_ssn'];
			$Sign_data['resp_code'] = $request['resp_code'];//
		}else{
			$sign = $request["signature"];
			$Sign_data['mchnt_cd'] = $request['mchnt_cd'];
			$Sign_data['mchnt_txn_ssn'] = $request['mchnt_txn_ssn'];
			$Sign_data['resp_code'] = $request['resp_code'];//
		}
		
		if ($class_act == 'CreateNewAcct'){
			$Sign_data['bank_nm'] = $request['bank_nm'];//开户行支行名称
			$Sign_data['capAcntNo'] = $request['capAcntNo'];
			$Sign_data['certif_id'] = $request['certif_id'];//
			$Sign_data['city_id'] = $request['city_id'];//开户行地区代码
			$Sign_data['cust_nm'] = $request['cust_nm'];
			$Sign_data['email'] =  $request['email'];//
			$Sign_data['mobile_no'] = $request['mobile_no'];//
			$Sign_data['parent_bank_id'] = $request['parent_bank_id'];//开户行行别
			$Sign_data['user_id_from'] = $request['user_id_from'] ;//
			if(isset($request['artif_nm'])&&$request['artif_nm'] != "" && $request['artif_nm'] != $request['cust_nm'])
			{
				$Sign_data['artif_nm'] = $request['artif_nm'];
			}
		}else if ($class_act == 'DoDpTrade'){
			if($request["from"] == "index" || $request["from"] == "")
			{
				if(isset($request['rem']))
				{
					$Sign_data['rem'] = $request['rem'];
				}
				else
				{
					$Sign_data['resp_desc'] = $request['resp_desc'];
				}
			}	
			$Sign_data['login_id'] = $request['login_id'];//用户登录名
			$Sign_data['amt'] = $request['amt'];
		}else if ($class_act == 'DoDwTrade'){
			$Sign_data['login_id'] = $request['login_id'];//用户登录名
			$Sign_data['amt'] = $request['amt'];
		}else if ($class_act == 'RegisterCreditor'){
			$Sign_data['contract_no'] = $request['contract_no'];//
		}else if ($class_act == 'BindBankCard'){
			$Sign_data['desc_code'] = $request['desc_code'];//返回码说明
		}

		if($class_act == 'RegisterCreditor'){
			$Sign_old = $request['rsaXML'];
			$pSign = 1;
		}else{
			ksort($Sign_data);
			foreach($Sign_data as $k => $v){
				if($class_act == 'CreateNewAcct'&&$k == 'user_id_from'){
					$Sign_old .=$v;
					$Sign_old_a .=$k;
				}else if (
				($class_act == 'DoDpTrade'&&$k == 'resp_desc' && ($request["from"] == "index" || $request["from"] == "") && !isset($Sign_data['rem']))
				|| 
				($class_act == 'DoDpTrade'&&$k == 'resp_code' && ($request["from"] == "index" || $request["from"] == "") && isset($Sign_data['rem']))
				||
				($class_act == 'DoDpTrade'&&$k == 'resp_code' && ($request["from"] != "index" && $request["from"] != ""))
				)
				{
					$Sign_old .=$v;
					$Sign_old_a .=$k;
				}else if (($class_act == 'DoDwTrade'||$class_act == 'RegisterCreditor')&&$k == 'resp_code'){
					$Sign_old .=$v;
					$Sign_old_a .=$k;
				}else if($class_act == 'BindBankCard'&&$k == 'resp_desc'){
					$Sign_old .=$v;
					$Sign_old_a .=$k;
				}else{
					$Sign_old .= $v."|";
					$Sign_old_a .= $k."+|+";
				}
			}
			
			$pSign=rsaVerify($Sign_old,PUBILC_KEY_PATH,$sign);

		} 
		
		$str3Req =array();
		$str3Req['mchnt_txn_ssn'] =$Sign_data['mchnt_txn_ssn'];
		$str3Req['code'] = $Sign_data['resp_code']; 
		$str3Req['message']= '';
		//$str3Req['description'] =$fuiou_code[$str3Req['code']];
		$str3Req['description'] = strim($request['resp_desc']);
		if($pSign){
			if ($class_act == 'CreateNewAcct'){
				$str3Req['bank_nm'] =$Sign_data['bank_nm'];
				$str3Req['city_id'] =$Sign_data['city_id'];
				$str3Req['parent_bank_id'] =$Sign_data['parent_bank_id'];
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/CreateNewAcct.php');
				$status = CreateNewAcctCallBack($str3Req);
				if($status){
					$str3Req['description'] = '开户成功';
					if ($request['from'] == 'app'){
						//echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
                        $app_url= SITE_DOMAIN."/wap/index.php?ctl=show_fuiou_result&info=".$str3Req["description"]."&status=1";
                        $re=file_get_contents($app_url);
                        print_r($re);
					}
					else if ($request['from'] == 'wap'){
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php');
					}else{
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=home');
					}
				}else{
					
					if ($request['from'] == 'app'){
						//echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
                        $app_url= SITE_DOMAIN."/wap/index.php?ctl=show_fuiou_result&info=".$str3Req["description"]."&status=0";
                        $re=file_get_contents($app_url);
                        print_r($re);
					}
					else if ($request['from'] == 'wap'){
						showIpsInfo("状态码:".$str3Req["code"].$str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php');
					}else{
						showIpsInfo("状态码:".$str3Req["code"].$str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=home');
					}
				}
				
			}else if ($class_act == 'DoDpTrade'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoDpTrade.php');				
				$status = DoDpTradeCallBack($str3Req);
				if($status){
					$str3Req["description"] = '充值成功';
					if ($request['from'] == 'app'){
						//echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
						//echo '<img src="http://www.xsslicai.com/public/new_images/fuiou_incharge_succ.png" style="width:100%;height:100%;">';
						$app_url= SITE_DOMAIN."/wap/index.php?ctl=show_fuiou_result&info=".$str3Req["description"]."&status=1";
						$re=file_get_contents($app_url);
						print_r($re);
					}else if ($request['from'] == 'wap'){
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php');
					}else{
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=account&act=fuioupay_recharge');
					}
				}else{
					if ($request['from'] == 'app'){
						//echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
                        $app_url= SITE_DOMAIN."/wap/index.php?ctl=show_fuiou_result&info=".$str3Req["description"]."&status=0";
                        $re=file_get_contents($app_url);
                        print_r($re);
					}else if ($request['from'] == 'wap'){
						showIpsInfo("状态码:".$str3Req["code"].$str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php');
					}else{
						showIpsInfo("状态码:".$str3Req["code"].$str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=account&act=fuioupay_recharge');
					}
				}
				
			}else if ($class_act == 'BindBankCard'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/BindBankCard.php');				
				$status =  BindBankCardCallBack($str3Req);				
				if($status){
					$str3Req["description"] = '更换银行卡成功，等待人工审核';
					if ($request['from'] == 'app'){
						echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
					}else if ($request['from'] == 'wap'){
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
					}else{
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=account&act=money_carry_bank');
					}
				}else{
					showIpsInfo("状态码:".$str3Req["code"].$str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=account&act=money_carry_bank');
				}
				
			}else if ($class_act == 'DoDwTrade'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoDwTrade.php');
				$this->post_url=$this->post_url.'transferBu.action';				
				$status = DoDwTradeCallBack($str3Req,$this->mchnt_cd,$this->post_url,$this->mchnt_user);
				if($status){
					$str3Req["description"] = '提现成功';
					if ($request['from'] == 'app'){
						//echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
                        $app_url= SITE_DOMAIN."/wap/index.php?ctl=show_fuiou_result&info=".$str3Req["description"]."&status=1";
                        $re=file_get_contents($app_url);
                        print_r($re);
					}else if ($request['from'] == 'wap'){
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
					}else{					
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=account&act=fuioupay_withdraw');	
					}
				}else{
					
					if ($request['from'] == 'app'){
						//echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
                        $app_url= SITE_DOMAIN."/wap/index.php?ctl=show_fuiou_result&info=".$str3Req["description"]."&status=0";
                        $re=file_get_contents($app_url);
                        print_r($re);
					}else if ($request['from'] == 'wap'){
						showIpsInfo("状态码:".$str3Req["code"].$str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php');
					}else{					
						showIpsInfo("状态码:".$str3Req["code"].$str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=account&act=fuioupay_withdraw');	
					}
				}
				
				
						
			}else if ($class_act == 'DoBids'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoBids.php');
				DoBidsCallBack($str3Req);		
				if ($request['from'] == 'app'){
					showIpsInfo($str3Req["description"]);
				}else if ($request['from'] == 'wap'){
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
				}else{					
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT);	
				}				
			}else if ($class_act == 'RegisterCreditor'){
				$str3Req['contract_no']= $Sign_data['contract_no'];
				
				//投资,登记债权人
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RegisterCreditor.php');				
				$ipsdata = RegisterCreditorCallBack($str3Req);
				
				if($ipsdata){
					if ($request['from'] == 'app'){
						echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
					}else if ($request['from'] == 'wap'){
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
					}else{
						if($ipsdata)
							showIpsInfo($str3Req["description"],url("account#estate_invest_record","deal",array("id"=>$ipsdata['deal_id'])));	
						else
							showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/index.php?ctl=account&act=estate_invest_record');	
					}
				}else{
					showIpsInfo('预冻结失败',SITE_DOMAIN.APP_ROOT.'/index.php?ctl=account&act=estate_invest_record');
				}
				
				
			}else if ($class_act == 'DoLoans'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoLoans.php');
				$ipsdata = RepaymentNewTradeCallBack($str3Req);
				
				if ($request['from'] == 'app'){
					showIpsInfo($str3Req["description"]);
				}else if ($request['from'] == 'wap'){
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
				}else{
					if($ipsdata)
						showIpsInfo($ipsdata["info"],SITE_DOMAIN.APP_ROOT."/".URL_NAME."?m=Deal&a=full");
						//showIpsInfo($str3Req["description"],url("index","uc_deal#quick_refund",array("id"=>$ipsdata['deal_id'])));
					else
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT);
				}
				
					
			}else if ($class_act == 'RepaymentNewTrade'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RepaymentNewTrade.php');
				$ipsdata = RepaymentNewTradeCallBack($str3Req,$this->mchnt_cd,$this->post_url);
				
				if ($request['from'] == 'app'){
					showIpsInfo($str3Req["description"]);
				}else if ($request['from'] == 'wap'){
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
				}else{
					if($ipsdata)
						showIpsInfo($str3Req["description"],url("index","uc_deal#refund"));
					else
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT);
				}
			}else if ($class_act == 'RepaymentRepayCallBack'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RepaymentNewTrade.php');
				$ipsdata = RepaymentRepayCallBack($str3Req);
				
				if ($request['from'] == 'app'){
					showIpsInfo($str3Req["description"]);
				}else if ($request['from'] == 'wap'){
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
				}else{
					if($ipsdata)
						showIpsInfo($str3Req["description"],url("index","uc_deal#refund"));
						//showIpsInfo($str3Req["description"],url("index","uc_deal#quick_refund",array("id"=>$ipsdata['deal_id'])));
					else
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT);
				}
			}else if ($class_act == 'RegisterCretansfer'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RegisterCretansfer.php');				
				RegisterCretansferCallBack($str3Req,$this->mchnt_cd,$this->post_url);
				
				if ($request['from'] == 'app'){
					showIpsInfo($str3Req["description"]);
				}else if ($request['from'] == 'wap'){
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
				}else{
					if ($request['from'] == 'app'){
						showIpsInfo($str3Req["description"]);
					}else{
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT);	
					}
				}
				
							
			}else if ($class_act == 'RegisterCretansferBack'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RegisterCretansfer.php');				
				RegisterCretansferBack($str3Req);
				
				
				if ($request['from'] == 'app'){
					showIpsInfo($str3Req["description"]);
				}else if ($request['from'] == 'wap'){
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
				}else{
					if ($request['from'] == 'app'){
						showIpsInfo($str3Req["description"]);
					}else{
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT);	
					}
				}			
			}
			/*else if ($class_act == 'GuaranteeUnfreeze'){
				require_once(APP_ROOT_PATH.'system/collocation/ips/GuaranteeUnfreeze.php');				
				GuaranteeUnfreezeCallBack($pMerCode,$pErrCode,$pErrMsg,$str3Req);				
				showIpsInfo($pErrMsg,SITE_DOMAIN.APP_ROOT);				
			}else if ($class_act == 'RegisterGuarantor'){
				require_once(APP_ROOT_PATH.'system/collocation/ips/RegisterGuarantor.php');				
				RegisterGuarantorCallBack($pMerCode,$pErrCode,$pErrMsg,$str3Req);				
				showIpsInfo($pErrMsg,SITE_DOMAIN.APP_ROOT);				
			}*/
			else if ($class_act == 'Transfer'){
				require_once(APP_ROOT_PATH.'system/collocation/ips/Transfer.php');
				$result = TransferCallBack($pMerCode,$pErrCode,$pErrMsg,$str3Req);
				if ($request['from'] == 'app'){
					showIpsInfo($pErrMsg);
				}else if ($request['from'] == 'wap'){
					if(intval($str3Req["pTransferType"])==4)
						showIpsInfo($pErrMsg,SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
					else
						showIpsInfo($pErrMsg,SITE_DOMAIN.APP_ROOT);					
				}else{
					if(intval($str3Req["pTransferType"])==4)
						showIpsInfo($pErrMsg,url("index","transfer#detail",array("id"=>$result['id'])));
					else
						showIpsInfo($pErrMsg,SITE_DOMAIN.APP_ROOT);
				}
				
				
			}
			else if ($class_act == 'SincerityGoldFreeze'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/SincerityGoldFreeze.php');				
				SincerityGoldFreezeCallBack($str3Req);				
				if ($request['from'] == 'app'){
					echo $str3Req["description"]."<br />请点左上角<b>返回</b>按钮";
				}else if ($request['from'] == 'wap'){
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
				}else{
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT);
				}
			}else if ($class_act == 'DoSiteRepay'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoSiteRepay.php');
				$ipsdata = DoSiteRepayCallBack($str3Req,$this->mchnt_cd,$this->post_url);
				
				if ($request['from'] == 'app'){
					showIpsInfo($str3Req["description"]);
				}else if ($request['from'] == 'wap'){
					showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT.'/wap/index.php?ctl=uc_center');
				}else{
					if($ipsdata)
						showIpsInfo($str3Req["description"],url("index","uc_deal#refund"));
					else
						showIpsInfo($str3Req["description"],SITE_DOMAIN.APP_ROOT);
				}
			}
			
		}else{
			echo "<br/>验签不通过:$localSign";exit;
		}	
	}
	
	//(后台回调)
	function notify($request,$class_act){
		$fuiou_code = fuiou_code();
		$fuioupay_log = array();
		$fuioupay_log['code'] = 'notify';
		$fuioupay_log['create_date'] = to_date(TIME_UTC,'Y-m-d H:i:s');
		$fuioupay_log['html'] = http_build_query($_REQUEST);
		$GLOBALS['db']->autoExecute(DB_PREFIX."fuioupay_log",$fuioupay_log);
		
		$Sign_data = array();
		if($request){
			$sign = $request["signature"];
			$Sign_data['mchnt_cd'] = $request['mchnt_cd'];
			$Sign_data['mchnt_txn_ssn'] = $request['mchnt_txn_ssn'];
			$Sign_data['resp_code'] = $request['resp_code'];//
		}else{
			$sign = $request["signature"];
			$Sign_data['mchnt_cd'] = $request['mchnt_cd'];
			$Sign_data['mchnt_txn_ssn'] = $request['mchnt_txn_ssn'];
			$Sign_data['resp_code'] = $request['resp_code'];//
		}
		
		if ($class_act == 'CreateNewAcct'){
			$Sign_data['bank_nm'] = $request['bank_nm'];//开户行支行名称
			$Sign_data['capAcntNo'] = $request['capAcntNo'];
			$Sign_data['certif_id'] = $request['certif_id'];//
			$Sign_data['city_id'] = $request['city_id'];//开户行地区代码
			$Sign_data['cust_nm'] = $request['cust_nm'];
			$Sign_data['email'] =  $request['email'];//
			$Sign_data['mobile_no'] = $request['mobile_no'];//
			$Sign_data['parent_bank_id'] = $request['parent_bank_id'];//开户行行别
			$Sign_data['user_id_from'] = $request['user_id_from'] ;//
			if(isset($request['artif_nm'])&&$request['artif_nm'] != "" && $request['artif_nm'] != $request['cust_nm'])
			{
				$Sign_data['artif_nm'] = $request['artif_nm'];
			} 
		}else if ($class_act == 'DoDpTrade'){
			if($request["from"] == "index" || $request["from"] == "")
			{
				if(isset($request['rem']))
				{
					$Sign_data['rem'] = $request['rem'];
				}
				else
				{
					$Sign_data['resp_desc'] = $request['resp_desc'];
				}
			}	
			$Sign_data['login_id'] = $request['login_id'];//用户登录名
			$Sign_data['amt'] = $request['amt'];
		}else if ($class_act == 'DoDwTrade'){
			$Sign_data['login_id'] = $request['login_id'];//用户登录名
			$Sign_data['amt'] = $request['amt'];
		}else if ($class_act == 'RegisterCreditor'){
			$Sign_data['contract_no'] = $request['contract_no'];//
		}else if ($class_act == 'BindBankCard'){
			$Sign_data['desc_code'] = $request['desc_code'];//返回码说明
		}

		if($class_act == 'RegisterCreditor'){
			$Sign_old = $request['rsaXML'];
			$pSign = 1;
		}else{
			ksort($Sign_data);
			foreach($Sign_data as $k => $v){
				if($class_act == 'CreateNewAcct'&&$k == 'user_id_from'){
					$Sign_old .=$v;
					$Sign_old_a .=$k;
				}else if (
				($class_act == 'DoDpTrade'&&$k == 'resp_desc' && ($request["from"] == "index" || $request["from"] == "") && !isset($Sign_data['rem']))
				|| 
				($class_act == 'DoDpTrade'&&$k == 'resp_code' && ($request["from"] == "index" || $request["from"] == "") && isset($Sign_data['rem']))
				||
				($class_act == 'DoDpTrade'&&$k == 'resp_code' && ($request["from"] != "index" && $request["from"] != ""))
				)
				{
					$Sign_old .=$v;
					$Sign_old_a .=$k;
				}else if (($class_act == 'DoDwTrade'||$class_act == 'RegisterCreditor')&&$k == 'resp_code'){
					$Sign_old .=$v;
					$Sign_old_a .=$k;
				}else if($class_act == 'BindBankCard'&&$k == 'resp_desc'){
					$Sign_old .=$v;
					$Sign_old_a .=$k;
				}else{
					$Sign_old .= $v."|";
					$Sign_old_a .= $k."+|+";
				}
			}
			
			$pSign=rsaVerify($Sign_old,PUBILC_KEY_PATH,$sign);
		} 
		
		$str3Req =array();
		$str3Req['mchnt_txn_ssn'] =$Sign_data['mchnt_txn_ssn'];
		$str3Req['code'] = $Sign_data['resp_code']; 
		$str3Req['message']= '';
		$str3Req['description'] =$fuiou_code[$str3Req['code']];
		if($pSign){
			if ($class_act == 'CreateNewAcct'){
				$str3Req['bank_nm'] =$Sign_data['bank_nm'];
				$str3Req['city_id'] =$Sign_data['city_id'];
				$str3Req['parent_bank_id'] =$Sign_data['parent_bank_id'];
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/CreateNewAcct.php');
				CreateNewAcctCallBack($str3Req);
			}else if ($class_act == 'DoDpTrade'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoDpTrade.php');				
				DoDpTradeCallBack($str3Req);
				
			}else if ($class_act == 'BindBankCard'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/BindBankCard.php');				
				BindBankCardCallBack($str3Req);				
			}else if ($class_act == 'DoDwTrade'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoDwTrade.php');
				$this->post_url=$this->post_url.'transferBu.action';				
				DoDwTradeCallBack($str3Req,$this->mchnt_cd,$this->post_url,$this->mchnt_user);
						
			}else if ($class_act == 'DoBids'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoBids.php');
				DoBidsCallBack($str3Req);					
			}else if ($class_act == 'RegisterCreditor'){
				$str3Req['contract_no']= $Sign_data['contract_no'];
				
				//投资,登记债权人
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RegisterCreditor.php');				
				RegisterCreditorCallBack($str3Req);
			}else if ($class_act == 'DoLoans'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/DoLoans.php');
				RepaymentNewTradeCallBack($str3Req);
			}else if ($class_act == 'RepaymentNewTrade'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RepaymentNewTrade.php');
				RepaymentNewTradeCallBack($str3Req,$this->mchnt_cd,$this->post_url);
			}else if ($class_act == 'RepaymentRepayCallBack'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RepaymentNewTrade.php');
				RepaymentRepayCallBack($str3Req);
			}else if ($class_act == 'RegisterCretansfer'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RegisterCretansfer.php');				
				RegisterCretansferCallBack($str3Req,$this->mchnt_cd,$this->post_url);
							
			}else if ($class_act == 'RegisterCretansferBack'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/RegisterCretansfer.php');				
				RegisterCretansferBack($str3Req);		
			}
			/*else if ($class_act == 'GuaranteeUnfreeze'){
				require_once(APP_ROOT_PATH.'system/collocation/ips/GuaranteeUnfreeze.php');				
				GuaranteeUnfreezeCallBack($pMerCode,$pErrCode,$pErrMsg,$str3Req);				
				showIpsInfo($pErrMsg,SITE_DOMAIN.APP_ROOT);				
			}else if ($class_act == 'RegisterGuarantor'){
				require_once(APP_ROOT_PATH.'system/collocation/ips/RegisterGuarantor.php');				
				RegisterGuarantorCallBack($pMerCode,$pErrCode,$pErrMsg,$str3Req);				
				showIpsInfo($pErrMsg,SITE_DOMAIN.APP_ROOT);				
			}*/
			else if ($class_act == 'Transfer'){
				require_once(APP_ROOT_PATH.'system/collocation/ips/Transfer.php');
				TransferCallBack($pMerCode,$pErrCode,$pErrMsg,$str3Req);		
				
			}
			else if ($class_act == 'SincerityGoldFreeze'){
				require_once(APP_ROOT_PATH.'system/collocation/fuioupay/SincerityGoldFreeze.php');				
				SincerityGoldFreezeCallBack($str3Req);				
			}
			
		}else{
			echo "<br/>验签不通过:$localSign";exit;
		}	
	}
}
?>